//
//  XYHomeNavigationView.m
//  WBBaseProject
//
//  Created by 吴斌 on 2018/3/21.
//  Copyright © 2018年 吴斌. All rights reserved.
//

#import "XYHomeNavigationView.h"

@implementation XYHomeNavigationView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    UILabel *titleLb = [[UILabel alloc] init]; 
    titleLb.text = @"幸运贷";
    _titleLb = titleLb;
    titleLb.font = [UIFont boldSystemFontOfSize:19];
    titleLb.textColor = WB_RGBColor(255, 255, 255);
    [self addSubview:titleLb];
    [titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(0);
        make.bottom.equalTo(-10);
    }];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    _rightBtn = btn;
    [btn setImage:WB_ImageName(@"qiandao") forState:UIControlStateNormal];
    [btn setTitle:@" 签到" forState:UIControlStateNormal];
    btn.titleLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:btn];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(-15);
        make.bottom.equalTo(-10);
    }];
    
    
    UIButton *left = [UIButton buttonWithType:UIButtonTypeCustom];
    _leftBtn = left;
    [left setImage:WB_ImageName(@"leftBack_white") forState:UIControlStateNormal];
    //返回
    
    [self addSubview:left];
    [left mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(10);
        make.top.equalTo(20);
        make.bottom.equalTo(0);
        make.width.equalTo(40);
    }];
}

/**
 *  修改颜色
 */
- (void)changeColorWithState:(BOOL)state {
    if (state) {
        _titleLb.textColor = [UIColor blackColor];
        [_rightBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_leftBtn setImage:WB_ImageName(@"返回") forState:UIControlStateNormal];
    }else{
        _titleLb.textColor = [UIColor whiteColor];
        [_rightBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_leftBtn setImage:WB_ImageName(@"leftBack_white") forState:UIControlStateNormal];
    }
    
}

@end
